home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWMemory / Include / FWFixMem.h next >
Encoding:
Text File  |  1996-04-25  |  1.5 KB  |  67 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWFixMem.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWFIXMEM_H
  11. #define FWFIXMEM_H
  12.  
  13. #include <stddef.h>
  14.  
  15. #ifndef FWSTDDEF_H
  16. #include "FWStdDef.h"
  17. #endif
  18.  
  19. //========================================================================================
  20. // Foreware declarations
  21. //========================================================================================
  22.  
  23. struct FW_SPrivFixedNode;
  24. struct FW_SPrivFixedBlock;
  25.  
  26. //========================================================================================
  27. // CLASS FW_CFixedAllocator
  28. //========================================================================================
  29.  
  30. class FW_CFixedAllocator
  31. {
  32. public:
  33.  
  34. // ----- Construction
  35.  
  36.                         FW_CFixedAllocator(
  37.                             short allocSize
  38. #ifdef FW_DEBUG
  39.                             , const char* name = "Unknown"
  40. #endif                            
  41.                         );
  42.                         ~FW_CFixedAllocator();
  43.  
  44. // ----- Allocation
  45.  
  46.     void*                Allocate();
  47.     void                Free(void* block);
  48.     
  49. // ----- Implementation
  50.  
  51. private:
  52.     long                fAllocCount;
  53.     short                fAllocSize;
  54.     FW_SPrivFixedNode*    fFreeList;
  55.     FW_SPrivFixedBlock*    fBlockList;
  56.     
  57. #ifdef FW_DEBUG
  58.     const char*            fDebugName;
  59. #endif
  60.  
  61.     // No copying
  62.                         FW_CFixedAllocator(const FW_CFixedAllocator& );
  63.     FW_CFixedAllocator&    operator=(const FW_CFixedAllocator& );
  64. };
  65.  
  66. #endif // FWFIXMEM_H
  67.